<?php
namespace app\wempapi\controller;
use app\common\controller\Frontend;
use app\wempapi\model\ServType;
use app\wempapi\model\ServService;
use app\wempapi\model\ServTeam;

class Serve extends Frontend
{
    protected array $noNeedLogin = ['*'];
   

    public function detail(){
        $id = $this->request->param('id');
        $info = ServService::where('id',$id)->find();
        $this->success('ok',$info);
    }
    public function index(){
        $type = ServType::where('status',1)->select()->toArray();
        foreach ($type as $k=>$v){
            $type[$k]['child'] = ServService::where('type_id',$v['id'])->select()->toArray();
        }
        $this->success('ok',$type);
    }

    public function team(){
        $id = $this->request->param('id');
        $type = ServTeam::where('status',1)->where('service_id','FIND_IN_SET',$id)->select()->toArray();
        $this->success('ok',$type);
    }

    public function teamdetail(){
        $id = $this->request->param('id');
        $info = ServTeam::where('id',$id)->find();
        $this->success('ok',$info);
    }
}